package math

import (
	"jvm/nzpJvm/instructions/base"
	"jvm/nzpJvm/runtime_area"
)

// 从操作数栈弹出两个int并且相加，将相加的结果压入操作数栈
type IADD struct {
	base.NoOperandsInstruction
}

func (self *IADD) Execute(frame *runtime_area.Frame) {
	stack := frame.OperandStack()
	intPre := stack.PopInt()
	intNext := stack.PopInt()
	stack.PushInt(intNext + intPre)
}
